package com.jackstraw.jack_base.datasource.elasticsearch.entity;


import com.jackstraw.jack_base.datasource.elasticsearch.aspect.annotation.CollectionType;
import com.jackstraw.jack_base.datasource.elasticsearch.aspect.annotation.SearchFind;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Setting;

import java.util.List;

@Data
@ToString
@Document(indexName = "zoo")
@Setting(shards = 1, replicas = 1)
public class Zoo extends ElasticSearchBaseEntity<Zoo> {

    /**
     * 动物园名称
     */
    @SearchFind
    @Field(store = true, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word", type = FieldType.Text)
    private String zooName;


    /**
     * 狗的集合
     */
    @CollectionType(clas = Cat.class)
    @Field(type = FieldType.Nested)
    private List<Dog> dogs;

    /**
     * 猫的集合
     */
    @CollectionType(clas = Cat.class)
    @Field(type = FieldType.Nested)
    private List<Cat> cats;


}
